import 'package:mall/utils/log/log_manager.dart';
import 'package:mall/utils/sc/state_controller.dart';

import '../model/user_entity.dart';
import '../service/user_service.dart';

class UserSc extends ModelSC<UserUserinfo> {

  @override
  void onReady() {
    super.onReady();
    refreshData().catchError((e) {
      LogM.log(e);
    });
  }

  @override
  Future<UserUserinfo?> loadData() async{

   final userEntity = await UserService.getUserInfo();
   if (userEntity == null) {
     throw Exception('当前可能未登录');
   }
   return userEntity;
  }
}